/*******************************************************************************
 * Copyright (c) 2011 TXT e-solutions SpA
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * This work was performed within the IoT_at_Work Project
 * and partially funded by the European Commission's
 * 7th Framework Programme under the research area ICT-2009.1.3
 * Internet of Things and enterprise environments.
 *
 *
 * Authors:
 *     Cristoforo Seccia (TXT e-solutions SpA)
 *
 * Contributors:
 *      Domenico Rotondi (TXT e-solutions SpA)
 *******************************************************************************/
package it.txt.access.capability.wizard;

import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JLabel;

/**
 *
 * @author Cristoforo Seccia (TXT e-solutions SpA)
 */
public class Wizard extends javax.swing.JFrame {

    public static final String NEXT_ACTION = "NextButtonActionCommand";
    public static final String BACK_ACTION = "BackButtonActionCommand";
    public static final String START_ACTION = "StartButtonActionCommand";
    private static final int DEFAULT_PANEL_POSITION = 0;
    public static final int FINISH_RETURN_CODE = 0;
    public static final int CANCEL_RETURN_CODE = 1;
    public static final int UNDEF_RETURN_CODE = -1;
    public static final int ERROR_RETURN_CODE = 2;
    private int returnCode = UNDEF_RETURN_CODE;
    private WizardController wizardController;
    private List<JLabel> panelSteps;

    /** Creates new form Wizard */
    public Wizard() {
        initComponents();
    }

    public void setWizardPanelDescriptors(WizardPanelDescriptor[] descriptors) throws WizardException {
        if (wizardController != null) {
            throw new WizardException("Wizard Descriptors already defined!");
        }
        initWizardPanelDescriptos(descriptors);
    }

    public int getReturnCode() {
        return returnCode;
    }

    public boolean getBackButtonEnabled() {
        return backButton.isEnabled();
    }

    public void setBackButtonEnabled(boolean newValue) {
        backButton.setEnabled(newValue);
    }

    public boolean getNextButtonEnabled() {
        return nextButton.isEnabled();
    }

    public void setNextButtonEnabled(boolean newValue) {
        nextButton.setEnabled(newValue);
    }

    public boolean getCancelButtonEnabled() {
        return cancelButton.isEnabled();
    }

    public void setCancelButtonEnabled(boolean newValue) {
        cancelButton.setEnabled(newValue);
    }
    
    public boolean getFinishButtonEnabled() {
        return finishButton.isEnabled();
    }

    public void setFinishButtonEnabled(boolean newValue) {
        finishButton.setEnabled(newValue);
    }

    public void setAccessRightsCreationPercentage(int percentage) {
        accessRightsCreationProgressBar.setValue(percentage);
    }

    public void setCurrentWizardLabel(int previouse, int current) {
        panelSteps.get(previouse).setFont(new java.awt.Font("Tahoma", 0, 12));
        panelSteps.get(current).setFont(new java.awt.Font("Tahoma", 1, 12));
    }

    private void close(int code) {
        returnCode = code;
        dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
    }

    private void displayCurrentpanel() {
        String currentPanelID = wizardController.getCurrentPanelDescriptor().getIdentifier();
        ((java.awt.CardLayout) (cardPanel.getLayout())).show(cardPanel, currentPanelID);
    }

    private void initWizardPanelDescriptos(WizardPanelDescriptor[] descriptors) {
        panelSteps = new ArrayList<JLabel>();
        wizardController = new WizardController(this);
        wizardStepsLabelPanel.setLayout(new BoxLayout(wizardStepsLabelPanel, BoxLayout.Y_AXIS));
        wizardStepsLabelPanel.add(Box.createVerticalStrut(20));
        for (int i = 0; i < descriptors.length; i++) {
            addWizardPanelStepsLabel(descriptors[i].getCanonicalName());
            wizardStepsLabelPanel.add(Box.createVerticalStrut(10));
            cardPanel.add(descriptors[i].getPanelController().getPanelComponent(), descriptors[i].getIdentifier());
            wizardController.registerPanel(descriptors[i].getIdentifier(), descriptors[i]);
        }
        wizardController.setCurrentPanel(descriptors[DEFAULT_PANEL_POSITION].getIdentifier(), Wizard.START_ACTION);
        displayCurrentpanel();
    }

    private void addWizardPanelStepsLabel(String label){
        JLabel panelname = new JLabel(label);
        panelname.setFont(new java.awt.Font("Tahoma", 0, 12));
        wizardStepsLabelPanel.add(panelname);        
        panelSteps.add(panelname);
    }

    private void handleNextButtonActionPerformed() {
        WizardPanelDescriptor currentPanelDescriptor = wizardController.getCurrentPanelDescriptor();
        String nextPanelIdentifier = currentPanelDescriptor.getNextIdentifier();
        wizardController.setCurrentPanel(nextPanelIdentifier, Wizard.NEXT_ACTION);
        displayCurrentpanel();
    }

    private void handleBackButtonActionPerformed() {
        WizardPanelDescriptor currentPanelDescriptor = wizardController.getCurrentPanelDescriptor();
        String backPanelIdentifier = currentPanelDescriptor.getBackIdentifier();
        wizardController.setCurrentPanel(backPanelIdentifier, Wizard.BACK_ACTION);
        displayCurrentpanel();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonsPanel = new javax.swing.JPanel();
        cancelButton = new javax.swing.JButton();
        nextButton = new javax.swing.JButton();
        backButton = new javax.swing.JButton();
        finishButton = new javax.swing.JButton();
        java.util.ResourceBundle versionBundle = java.util.ResourceBundle.getBundle("bundles/Version");
        version_label = new javax.swing.JLabel();
        progressPanel = new javax.swing.JPanel();
        wizardStepsPanelBack = new javax.swing.JPanel();
        wizardStepsPanelFront = new javax.swing.JPanel();
        txtlogolabel = new javax.swing.JLabel();
        wizardStepsLabelPanel = new javax.swing.JPanel();
        poweredByLabel = new javax.swing.JLabel();
        wizardProgressLabel = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        backCenterPanel = new javax.swing.JPanel();
        cardPanel = new javax.swing.JPanel();
        upperIoTLogoPanel = new javax.swing.JPanel();
        accessRightsCreationProgressBar = new javax.swing.JProgressBar();
        upperIoTLogoLabel = new javax.swing.JLabel();
        accessRightsCreationlabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        buttonsPanel.setBackground(new java.awt.Color(219, 218, 209));
        buttonsPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        cancelButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons_24x24/Cancel_24x24.png"))); // NOI18N
        cancelButton.setText("Cancel");
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelButtonActionPerformed(evt);
            }
        });

        nextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons_24x24/Next_24x24.png"))); // NOI18N
        nextButton.setText("Next");
        nextButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nextButtonActionPerformed(evt);
            }
        });

        backButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons_24x24/Previous_24x24.png"))); // NOI18N
        backButton.setText("Back");
        backButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backButtonActionPerformed(evt);
            }
        });

        finishButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons_24x24/Check_24x24.png"))); // NOI18N
        finishButton.setText("Finish");
        finishButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                finishButtonActionPerformed(evt);
            }
        });

        version_label.setFont(new java.awt.Font("Tahoma", 2, 10)); // NOI18N
        version_label.setText(java.text.MessageFormat.format(java.util.ResourceBundle.getBundle("bundles/WizardFrame").getString("versionText"), new Object[] {versionBundle.getString("wizard"), versionBundle.getString("schema")}));

        javax.swing.GroupLayout buttonsPanelLayout = new javax.swing.GroupLayout(buttonsPanel);
        buttonsPanel.setLayout(buttonsPanelLayout);
        buttonsPanelLayout.setHorizontalGroup(
            buttonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, buttonsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(version_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(backButton)
                .addGap(18, 18, 18)
                .addComponent(nextButton)
                .addGap(18, 18, 18)
                .addComponent(finishButton)
                .addGap(18, 18, 18)
                .addComponent(cancelButton)
                .addContainerGap())
        );
        buttonsPanelLayout.setVerticalGroup(
            buttonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(buttonsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(buttonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(version_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cancelButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(finishButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(nextButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(backButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        progressPanel.setBackground(new java.awt.Color(219, 218, 209));
        progressPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        wizardStepsPanelBack.setBackground(new java.awt.Color(255, 255, 255));

        wizardStepsPanelFront.setBackground(new java.awt.Color(255, 255, 255));
        wizardStepsPanelFront.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        txtlogolabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/logo_11202012_TXT E-SOLUTIONS.png"))); // NOI18N

        wizardStepsLabelPanel.setBackground(new java.awt.Color(255, 255, 255));

        javax.swing.GroupLayout wizardStepsLabelPanelLayout = new javax.swing.GroupLayout(wizardStepsLabelPanel);
        wizardStepsLabelPanel.setLayout(wizardStepsLabelPanelLayout);
        wizardStepsLabelPanelLayout.setHorizontalGroup(
            wizardStepsLabelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        wizardStepsLabelPanelLayout.setVerticalGroup(
            wizardStepsLabelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 317, Short.MAX_VALUE)
        );

        poweredByLabel.setFont(new java.awt.Font("Times New Roman", 3, 12)); // NOI18N
        poweredByLabel.setForeground(new java.awt.Color(36, 70, 173));
        poweredByLabel.setText("Powered by");

        javax.swing.GroupLayout wizardStepsPanelFrontLayout = new javax.swing.GroupLayout(wizardStepsPanelFront);
        wizardStepsPanelFront.setLayout(wizardStepsPanelFrontLayout);
        wizardStepsPanelFrontLayout.setHorizontalGroup(
            wizardStepsPanelFrontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(wizardStepsPanelFrontLayout.createSequentialGroup()
                .addGroup(wizardStepsPanelFrontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(wizardStepsLabelPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, wizardStepsPanelFrontLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(txtlogolabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(wizardStepsPanelFrontLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(poweredByLabel)))
                .addContainerGap())
        );
        wizardStepsPanelFrontLayout.setVerticalGroup(
            wizardStepsPanelFrontLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, wizardStepsPanelFrontLayout.createSequentialGroup()
                .addComponent(wizardStepsLabelPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
                .addComponent(poweredByLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtlogolabel)
                .addContainerGap())
        );

        wizardProgressLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        wizardProgressLabel.setText("Progress");

        javax.swing.GroupLayout wizardStepsPanelBackLayout = new javax.swing.GroupLayout(wizardStepsPanelBack);
        wizardStepsPanelBack.setLayout(wizardStepsPanelBackLayout);
        wizardStepsPanelBackLayout.setHorizontalGroup(
            wizardStepsPanelBackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(wizardStepsPanelBackLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(wizardStepsPanelBackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(wizardStepsPanelFront, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(wizardProgressLabel)
                    .addComponent(jSeparator1))
                .addContainerGap())
        );
        wizardStepsPanelBackLayout.setVerticalGroup(
            wizardStepsPanelBackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(wizardStepsPanelBackLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(wizardProgressLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(wizardStepsPanelFront, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout progressPanelLayout = new javax.swing.GroupLayout(progressPanel);
        progressPanel.setLayout(progressPanelLayout);
        progressPanelLayout.setHorizontalGroup(
            progressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, progressPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(wizardStepsPanelBack, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        progressPanelLayout.setVerticalGroup(
            progressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(progressPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(wizardStepsPanelBack, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        backCenterPanel.setBackground(new java.awt.Color(219, 218, 209));
        backCenterPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        cardPanel.setLayout(new java.awt.CardLayout());

        javax.swing.GroupLayout backCenterPanelLayout = new javax.swing.GroupLayout(backCenterPanel);
        backCenterPanel.setLayout(backCenterPanelLayout);
        backCenterPanelLayout.setHorizontalGroup(
            backCenterPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(backCenterPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE)
                .addContainerGap())
        );
        backCenterPanelLayout.setVerticalGroup(
            backCenterPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(backCenterPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cardPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        upperIoTLogoPanel.setBackground(new java.awt.Color(255, 255, 255));
        upperIoTLogoPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        accessRightsCreationProgressBar.setToolTipText("Access Rights Creation Percentage");
        accessRightsCreationProgressBar.setStringPainted(true);

        upperIoTLogoLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/IoT_logo.png"))); // NOI18N

        accessRightsCreationlabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        accessRightsCreationlabel.setText("Access Capability Completion Status");

        javax.swing.GroupLayout upperIoTLogoPanelLayout = new javax.swing.GroupLayout(upperIoTLogoPanel);
        upperIoTLogoPanel.setLayout(upperIoTLogoPanelLayout);
        upperIoTLogoPanelLayout.setHorizontalGroup(
            upperIoTLogoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, upperIoTLogoPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(upperIoTLogoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(accessRightsCreationlabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(accessRightsCreationProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addComponent(upperIoTLogoLabel)
                .addContainerGap())
        );
        upperIoTLogoPanelLayout.setVerticalGroup(
            upperIoTLogoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(upperIoTLogoPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(upperIoTLogoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(upperIoTLogoLabel)
                    .addGroup(upperIoTLogoPanelLayout.createSequentialGroup()
                        .addComponent(accessRightsCreationlabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(accessRightsCreationProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(progressPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(upperIoTLogoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(backCenterPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(buttonsPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(upperIoTLogoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(backCenterPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(progressPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextButtonActionPerformed
        handleNextButtonActionPerformed();
    }//GEN-LAST:event_nextButtonActionPerformed

    private void backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backButtonActionPerformed
        handleBackButtonActionPerformed();
    }//GEN-LAST:event_backButtonActionPerformed

    private void finishButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_finishButtonActionPerformed
        close(Wizard.FINISH_RETURN_CODE);
    }//GEN-LAST:event_finishButtonActionPerformed

    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
        close(Wizard.CANCEL_RETURN_CODE);
    }//GEN-LAST:event_cancelButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JProgressBar accessRightsCreationProgressBar;
    private javax.swing.JLabel accessRightsCreationlabel;
    private javax.swing.JButton backButton;
    private javax.swing.JPanel backCenterPanel;
    private javax.swing.JPanel buttonsPanel;
    private javax.swing.JButton cancelButton;
    private javax.swing.JPanel cardPanel;
    private javax.swing.JButton finishButton;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JButton nextButton;
    private javax.swing.JLabel poweredByLabel;
    private javax.swing.JPanel progressPanel;
    private javax.swing.JLabel txtlogolabel;
    private javax.swing.JLabel upperIoTLogoLabel;
    private javax.swing.JPanel upperIoTLogoPanel;
    private javax.swing.JLabel version_label;
    private javax.swing.JLabel wizardProgressLabel;
    private javax.swing.JPanel wizardStepsLabelPanel;
    private javax.swing.JPanel wizardStepsPanelBack;
    private javax.swing.JPanel wizardStepsPanelFront;
    // End of variables declaration//GEN-END:variables

}
